﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
namespace Things.Web.Farm
{
    public partial class Show : Page
    {
        public string strid = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
                {
                    strid = Request.Params["id"];
                    Guid FarmID = new Guid(strid);
                    ShowInfo(FarmID);
                }
            }
        }

        private void ShowInfo(Guid FarmID)
        {
            Things.BLL.Farm bll = new Things.BLL.Farm();
            Things.Model.Farm model = bll.GetModel(FarmID);
            this.lblFarmID.Text = model.FarmID.ToString();
            Things.BLL.Farmer farmerBLL = new BLL.Farmer();
            Things.Model.Farmer farmer = farmerBLL.GetModel(model.FarmerID);
            this.lblFarmerID.Text = farmer != null ? farmer.FarmerName : string.Empty;
            this.lblAddress.Text = model.Address;
            this.lblCoordinate.Text = model.Coordinate;

        }

        protected void btnGoList_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }


    }
}
